<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>09_员工列表练习</title>
</head>
<body>
<input type="text" placeholder="请输入员工姓名" id="name">
<input type="number" placeholder="请输入员工工资" id="salary">
<input type="text" placeholder="请输入员工岗位" id="job">
<button onclick="add()">添加员工</button>
<hr>
<table border="1px">
    <caption>员工表</caption>
    <tr>
        <th>姓名</th>
        <th>工资</th>
        <th>岗位</th>
    </tr>
</table>
<script>
    function add(){
        let trE = document.createElement('tr');
        let tdE1 = document.createElement('td');
        let tdE2 = document.createElement('td');
        let tdE3 = document.createElement('td');
        let name = document.getElementById('name').value;
        let salary = document.getElementById('salary').value;
        let job = document.getElementById('job').value;
        tdE1.innerHTML(name);
        tdE2.innerHTML(salary);
        tdE3.innerHTML(job);
        trE.append(tdE1,tdE2,tdE3)
        let tableE = document.querySelector('table');
        tableE.append(trE);
    }
</script>

</body>
</html>